using System;
using System.Security;
using System.Security.Cryptography;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace stsdev {
  public class StrongNameKeyBuilder {

    public static void CreateNew(string fileName) {
      CspParameters parms = new CspParameters();
      parms.KeyNumber = 2;
      RSACryptoServiceProvider provider = new RSACryptoServiceProvider(1024, parms);
      byte[] array = provider.ExportCspBlob(!provider.PublicOnly);

      using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) {
        fs.Write(array, 0, array.Length);
      }
    }

    public static void AddKeyFileToProject() {
      File.Copy(SolutionBuilder.KeyFileSource, SolutionBuilder.KeyFileName);
      ProjectFileBuilder.AddSourceFile(SolutionBuilder.KeyFileName, SourceFileTypeEnum.None);
    }
  }
}
